package com.le.tester.book.concurrentchallenge.memorymodel16;

/**
 * createTime：2025-05-27 10:44
 * description：不要这么做，可能会出现重排序
 */
public class PossibleReordering {

    static int x = 0, y = 0;
    static int a = 0, b = 0;

    public static void main(String[] args) throws InterruptedException {
        Thread one = new Thread(() -> {
            a = 1;
            x = b;
        });
        Thread two = new Thread(() -> {
            b = 1;
            y = a;
        });

        one.start();two.start();
        one.join();two.join();
    }
}
